﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="DatHangOnline.ascx.cs"
    Inherits="ControlUser_DatHangOnline" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="newWindow" Namespace="newWindow" TagPrefix="cc1" %>
<%@ Register Assembly="CSharp_MessageBox" Namespace="CSharp_MessageBox" TagPrefix="CS_Msg" %>
<%@ Import Namespace="BCDataCenter" %>
<%@ Register Src="uscMsgBox.ascx" TagName="uscMsgBox" TagPrefix="uc1" %>
<fieldset>
    <legend>Nhập hóa đơn bán hàng</legend>
</fieldset>
<asp:Panel ID="Panel4" runat="server" BackColor="#EBEBEB" BorderStyle="None" Height="33px"
    Width="100%">
    <asp:ImageButton ID="btnNew" runat="server" Width="25px" Height="25px" ToolTip="Tạo hóa đơn mới"
        ImageUrl="~/WebMaster/Images/Document.png" />
    &nbsp;
    <asp:ImageButton ID="btnSave" runat="server" Width="25px" Height="25px" ToolTip="Lưu hóa đơn"
        ImageUrl="~/WebMaster/Images/Save.png" OnClick="btnSave_Click" />
    &nbsp;
    <asp:ImageButton ID="btnApKhuyenMai" runat="server" Width="25px" Height="25px" ToolTip="Áp khuyến mãi"
        ImageUrl="~/WebMaster/Images/Symbol-Check.png" />
    &nbsp;
    <asp:ImageButton ID="btnDelete" runat="server" Width="25px" Height="25px" ToolTip="Xóa khuyến mãi"
        ImageUrl="~/WebMaster/Images/Symbol-Delete.png" Visible="false" />
    <asp:ImageButton ID="CapNhatGia" runat="server" ToolTip="Cập nhật giá" Width="25px"
        ImageUrl="~/image/Symbol-Refresh.png" Visible="False" />
</asp:Panel>
<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" RenderMode="Block">
    <ContentTemplate>
        <br />
        <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" BackColor="#CCFFFF"
            Font-Names="Arial" Height="720px" Width="850px">
            <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Nhập thông tin" TabIndex="0">
                <ContentTemplate>
                    <fieldset>
                        <table>
                            <tr>
                                <td>
                                    Mã BA :
                                </td>
                                <td>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtMaBA" runat="server"></asp:TextBox>
                                </td>
                                <td>
                                </td>
                                <td>
                                    Tên BA :
                                </td>
                                <td>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtTenBA" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Số Chứng Từ :
                                </td>
                                <td>
                                </td>
                                <td>
                                    <asp:DropDownList ID="ddlSoChungTu" runat="server" DataTextField="tranno" DataValueField="tranno"
                                        AutoPostBack="True" OnSelectedIndexChanged="ddlSoChungTu_SelectedIndexChanged">
                                    </asp:DropDownList>
                                </td>
                                <td>
                                </td>
                                <td>
                                    Chi Nhánh :
                                </td>
                                <td>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtChiNhanh" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Đã In :
                                </td>
                                <td>
                                </td>
                                <td colspan="5">
                                    <asp:CheckBox ID="chkDaIn" runat="server" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="lbttongtien" runat="server" Text="Tổng tiền "></asp:Label>
                                </td>
                                <td>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtTongTien" runat="server" Width="200px" ReadOnly="True" Font-Bold="True"
                                        ForeColor="Red"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </fieldset>
                    <br />
                    <asp:GridView ID="gvChiTietDonHang" runat="server" AutoGenerateColumns="False" Width="100%"
                        ShowFooter="True" OnRowEditing="gvChiTietDonHang_RowEditing" OnRowUpdating="gvChiTietDonHang_RowUpdating"
                        OnRowCancelingEdit="gvChiTietDonHang_RowCancelingEdit">
                        <Columns>
                            <asp:TemplateField HeaderText="Mã hàng">
                                <ItemTemplate>
                                    <asp:Label ID="lblMaHang" runat="server" Text='<%# Bind("itemkey") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtTenHangEdit11" runat="server" Text='<%# Bind("itemkey") %>' ReadOnly="true"
                                        Width="97%"></asp:TextBox>
                                </EditItemTemplate>
                                <FooterStyle VerticalAlign="Top" />
                                <ItemStyle Width="70px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Tên hàng">
                                <ItemTemplate>
                                    <asp:Label ID="lblTenHang" runat="server" Text='<%# Bind("description") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtTenHangEdit" runat="server" Text='<%# Bind("description") %>'
                                        ReadOnly="true" Width="97%"></asp:TextBox>
                                </EditItemTemplate>
                                <FooterStyle VerticalAlign="Top" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Đơn Giá">
                                <ItemTemplate>
                                    <asp:Label ID="lblDonGia" runat="server" Text='<%# Bind("price") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtDonGiagEdit" runat="server" Text='<%# Bind("price") %>' ReadOnly="true"
                                        Width="97%"></asp:TextBox>
                                </EditItemTemplate>
                                <FooterStyle VerticalAlign="Top" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Khuyến Mãi">
                                <ItemTemplate>
                                    <asp:Label ID="lbtKhuyenMai" runat="server" Text='<%# Eval("KM") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:CheckBox ID="ChkSoLuongEdit" runat="server" Checked='<%# fBool(Eval("KM"))%>'
                                        Width="97%" AutoPostBack="true" OnTextChanged="ChkSoLuongEdit_TextChanged" Text='<%# Bind("KM") %>'>
                                    </asp:CheckBox>
                                </EditItemTemplate>
                                <FooterStyle VerticalAlign="Top" />
                                <ItemStyle Width="40px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Số lượng">
                                <ItemTemplate>
                                    <asp:Label ID="lblSoLuong" runat="server" Text='<%# Eval("shipqty") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtSoLuongEdit" runat="server" Width="97%" AutoPostBack="true" OnTextChanged="txtSoLuongEdit_TextChanged"
                                        Text='<%# Bind("shipqty") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <FooterStyle VerticalAlign="Top" />
                                <ItemStyle Width="40px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Sửa">
                                <EditItemTemplate>
                                    <div align="right">
                                        <asp:LinkButton ID="LinkButtonUpdate" runat="server" CausesValidation="True" CommandName="Update">
                                            <asp:Image ID="imgUpdate" runat="server" ImageUrl="../WebMaster/Images/Save16.png"
                                                AlternateText="Lưu" />
                                        </asp:LinkButton>
                                        <asp:LinkButton ID="LinkButtonCancel" runat="server" CausesValidation="False" CommandName="Cancel">
                                            <asp:Image ID="imgCancel" runat="server" ImageUrl="../WebMaster/Images/Cancel16.jpg"
                                                AlternateText="Hủy bỏ" />
                                        </asp:LinkButton>
                                    </div>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <div align="right">
                                        <asp:LinkButton ID="LinkButtonEdit" runat="server" CausesValidation="False" CommandName="Edit">
                                            <asp:Image ID="imgEdit" runat="server" ImageUrl="../WebMaster/Images/small_edit.png"
                                                AlternateText="Sửa" />
                                        </asp:LinkButton>
                                    </div>
                                </ItemTemplate>
                                <FooterStyle VerticalAlign="Top" />
                                <HeaderStyle Width="16px" HorizontalAlign="Center" />
                                <FooterTemplate>
                                </FooterTemplate>
                                <ItemStyle Width="20px" />
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                </ContentTemplate>
            </cc1:TabPanel>
        </cc1:TabContainer>
        <uc1:uscMsgBox ID="uscMsgBox1" runat="server" />
    </ContentTemplate>
</asp:UpdatePanel>
